import sys
import re

def count_zifu(file_path):
    with open(file_path, 'r',encoding='utf-8') as file:
        return len(file.read())

def count_words(file_path):
    with open(file_path, 'r',encoding='utf-8') as file:
        text = file.read()
        words = re.findall(r'\b\w+\b', text)
        return len(words)

def count_sentences(file_path):
    with open(file_path, 'r',encoding='utf-8') as file:
        text = file.read()
        sentences = re.split(r'[.!?]\s*', text)
        return len(sentences) - sentences.count('')

def count_lines(file_path):
    with open(file_path, 'r',encoding='utf-8') as file:
        return sum(1 for line in file)

def count_empty_lines(file_path):
    with open(file_path, 'r',encoding='utf-8') as file:
        return sum(1 for line in file if line.strip() == '')

def count_comment_lines(file_path):
    with open(file_path, 'r',encoding='utf-8') as file:
        lines = file.readlines()
        comment_count = 0
        for line in lines:
            if line.strip().startswith('//') or line.strip().startswith('#'):
                comment_count += 1
        return comment_count

def main():
    if len(sys.argv) < 3:
        print("Usage: wc.exe [-c|-w|-s|-l|-e|-C] file.txt")
        return

    command = sys.argv[1]
    file_path = sys.argv[2]

    if command == '-c':
        print(f"Character count: {count_zifu(file_path)}")
    elif command == '-w':
        print(f"Word count: {count_words(file_path)}")
    elif command == '-s':
        print(f"Sentence count: {count_sentences(file_path)}")
    elif command == '-l':
        print(f"Line count: {count_lines(file_path)}")
    elif command == '-e':
        print(f"Empty line count: {count_empty_lines(file_path)}")
    elif command == '-C':
        print(f"Comment line count: {count_comment_lines(file_path)}")
    else:
        print("Invalid command. Use -c, -w, -s, -l, -e, or -C.")

if __name__ == "__main__":
    main()